package com.wzp.yyptproject.until;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.Random;

public class NumberUtils {
    @Autowired
    private RedisUtils redisUtils;
    @Autowired
    private RedisTemplate redisTemplate;
    public String getChickCode(Integer num){
        final String source = "1908253674";
        StringBuilder str = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < num; i++) {
            str.append(source.charAt(random.nextInt(source.length()-1)));
        }
        String data= str.toString();
//      redisTemplate.opsForValue().set("logincode",data);
        redisUtils.set("checkCode",data);
        redisUtils.expire("checkCode",60);
        return data;
    }
}
